﻿@inherits OperationDialogBase<Guid?,bool,IotLocalResource>
<Form Loading="@_dialogLoading.Value"
      Model="_editModel"
      LabelCol="new ColLayoutParam { Span = 6 }"
      WrapperCol="new ColLayoutParam { Span = 18 }"
      ValidateMode="FormValidateMode.Complex"
      OnFinish="OnFormFinish"
      Context="model">
    <ResourceAuthorize ResourceKey="@CommonResourceKeys.SystemTenantAdministratorKey">
        <FormItem Label="@Localizer[nameof(SharedLocalResource.Tenant)]">
            <Select DataSource="@_tenants"
                    @bind-Value="@model.TenantId"
                    ValueName="@nameof(SystemTenantDto.Id)"
                    LabelName="@nameof(SystemTenantDto.Name)"
                    TItem="SystemTenantDto"
                    TItemValue="Guid?"
                    DefaultActiveFirstOption>
            </Select>
        </FormItem>
    </ResourceAuthorize>
    <FormItem >
        <Input @bind-Value="model.DeviceId" />
    </FormItem>
    <FormItem WrapperColOffset="4" WrapperColSpan="24">
        <Space>
            <SpaceItem>
                <Button Type="@ButtonType.Primary" HtmlType="submit">
                    @Localizer[nameof(SharedLocalResource.Save)]
                </Button>
            </SpaceItem>
            <SpaceItem>
                <Button OnClick="_=>base.CloseAsync()">
                    @Localizer[nameof(SharedLocalResource.Cancel)]
                </Button>
            </SpaceItem>
        </Space>
    </FormItem>
</Form>